home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / firmware-b43legacy-installer.postinst < prev    next >
Encoding:
Text File  |  2012-03-31  |  2.0 KB  |  86 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. tmp=`mktemp -q -d`
  6.  
  7. latest_firmware ()
  8. {
  9. cd $tmp
  10. export FIRMWARE_INSTALL_DIR="/lib/firmware"
  11.  
  12. # use apt proxy
  13. APT_PROXIES=$(apt-config shell \
  14. http_proxy Acquire::http::Proxy \
  15. https_proxy Acquire::https::Proxy \
  16. ftp_proxy Acquire::ftp::Proxy \
  17. )
  18.  
  19. if [ -n "$APT_PROXIES" ]; then
  20.         eval export $APT_PROXIES
  21. fi
  22.  
  23. wget --timeout=60 http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o
  24. if [ $? -ne 0 ]; then
  25.         echo "Some problem occurred during the firmware download. Please check your internet connection."
  26.         exit 0
  27.     else
  28.     if [ -d /lib/firmware/b43legacy ]; then
  29.        echo "Deleting old extracted firmware..."
  30.        rm -rf /lib/firmware/b43legacy
  31.     fi
  32.     if [ ! -d /lib/firmware/b43legacy ]; then
  33.        echo "Creating new firmware directory..."
  34.               mkdir -p /lib/firmware/b43legacy
  35.         fi
  36. fi
  37. b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" wl_apsta-3.130.20.0.o
  38. rm -rf $tmp
  39. }
  40.  
  41. # check environment
  42. if [ "$(stat -c %d/%i /)" != "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ];
  43.  then
  44.     echo "A chroot environment has been detected."
  45.     echo "Remember this firmware needs kernel >= 2.6.25."
  46.     latest_firmware
  47.     exit 0
  48.  else
  49.     echo "No chroot environment found. Starting normal installation"
  50. fi
  51.  
  52. # Fix for BCM4306 [14e4:4320] (rev 02)
  53. chip=`lspci -n | grep -o "14e4:4320 (rev 02)"` || true
  54. if [ "$chip" ] ; then
  55.    echo "Your card is BCM4306 [14e4:4320] (rev 02), using b43legacy firmware"
  56.    latest_firmware
  57.    exit 0
  58. fi
  59.  
  60. # check chip
  61. supported=0
  62. pci=`lspci -n | grep -o "14e4:[1234567890abcdef]\+"` || true
  63.  
  64. if [ -n "$pci" ]; then
  65.         for device in $pci; do
  66.                 device_id=`echo $device | cut -d: -f2`
  67.                 case $device_id in
  68.                 4301 | 4306 | 4320 | 4324 |  4325)
  69.                         supported=1
  70.                         break
  71.                 ;;
  72.         esac
  73.         done
  74. fi
  75.  
  76. if [ "$supported" = 0 ]; then
  77.         echo "No supported card found."
  78.         echo "Use b43 firmware. This is just for the b43legacy driver."
  79.         echo "Aborting."
  80.         exit 0
  81. fi
  82.  
  83. latest_firmware
  84.  
  85.  
  86.